package com.wolfpire.workflow.om;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 流程类型
 * @author linRJ
 *
 */

@SuppressWarnings("serial")
@Entity
@Table(name = "wf_type")
public class WfType implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", unique = true, nullable = false, length = 16)
	private Long id;
	
	@Column(name = "OID", length = 8)
	private Long oId;
	
	@Column(name = "TYPENAME")
	private String typeName;
	
	@Column(name = "PATH")
	private String path;
	
	@Column(name = "DEPTH", length = 18)
	private Long depth;
	
	@Column(name = "PARENTID", length = 18)
	private Long parentId;
	
	@Column(name = "NODEKEY")
	private String nodeKey;
	
	@Column(name = "CATKEY")
	private String catKey;
	
	@Column(name = "SN" , length = 8)
	private Long sn;
	
	@Column(name = "USERID" , length = 8)
	private Long userId;
	
	@Column(name = "DEPID" , length = 8)
	private Long depId;
	
	@Column(name = "leaf")
	private boolean leaf = true; // 是否是叶子节点 true 是, flase 否
	
	@Transient
	private Long _parentId;
	
	@Transient
	private String text;
	@Transient
	private String state;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getoId() {
		return oId;
	}

	public void setoId(Long oId) {
		this.oId = oId;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Long getDepth() {
		return depth;
	}

	public void setDepth(Long depth) {
		this.depth = depth;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public String getNodeKey() {
		return nodeKey;
	}

	public void setNodeKey(String nodeKey) {
		this.nodeKey = nodeKey;
	}

	public String getCatKey() {
		return catKey;
	}

	public void setCatKey(String catKey) {
		this.catKey = catKey;
	}

	public Long getSn() {
		return sn;
	}

	public void setSn(Long sn) {
		this.sn = sn;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getDepId() {
		return depId;
	}

	public void setDepId(Long depId) {
		this.depId = depId;
	}

	public Long get_parentId() {
		_parentId = this.parentId;
		return _parentId;
	}

	public void set_parentId(Long _parentId) {
		this._parentId = _parentId;
	}

	public String getText() {
		text = this.typeName;
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getState() {
		state = (this.leaf ? "open" : "closed");
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

}
